{# empty Twig template #}
{% extends'CNAMActimanBundle::layoutBody.html.twig' %}
{% block body %}

    {% block content %}
        <div class="row">
            <ul class="breadcrumb" style="margin-bottom: 5px;">
                <li>
                    Vous êtes ici :  
                </li>
                <li>
                    <a href="#">Gestion procédures</a>  
                </li>
                <li>
                    <a href="#">Liste des procédures</a>  
                </li>
            </ul>
            <div class="col-lg-12">
                <h2>Liste des procédures</h2>
                <hr align="center" width="90%" size="5">
                <div class="col-lg-12">
                    {% set procsansserv = '' %}
                        {% for service in list_service %}
                            <div class="panel panel-primary">
                                <div class="panel-heading">
                                    <h3 class="panel-title">
                                        {{ service.nomService }}
                                    </h3>
                                </div>
                                <div class="panel-body">            
                                    <div class="table-responsive">
                                        <table class="table table-bordered table-hover tablesorter">
                                            <thead>
                                                <tr>
                                                    <th width="24%">Procedure <i class="fa fa-sort"></i></th>
                                                    <th width="24%">Responsable <i class="fa fa-sort"></i></th>
                                                    <th width="20%">Date de Creation <i class="fa fa-sort"></i></th>
                                                    <th width="20%">Date de dernière modification <i class="fa fa-sort"></i></th>
                                                    <th width="12%"><center>Action <i class="fa fa-sort"></i></center></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                {% for procedure in list_procedure %}
                                                    {% if procedure.service == service %}
                                                        <tr>
                                                            <td>{{ procedure.nomProcedure }}</td>
                                                            {% if procedure.user!= null %}
                                                                <td>{{ procedure.user.nomUser }}</td>
                                                            {% else %}
                                                                <td>Pas de Responsable </td>
                                                            {% endif %}  
                                                            <td>{{ procedure.dateCreation|date("d/m/Y") }}</td>
                                                            <td>{{ procedure.dateModification|date("d/m/Y") }}</td>
                                                            <td><center><a href="{{path ('cnam_actiman_procedure_visuDetail',{'idpro': procedure.id})}}">Detail</a></center></td>
                                                    </tr>
                                                {% elseif procedure.service == null %}
                                                    {% set procsansserv = 'vrai' %}
                                                        {% endif %}
                                                            {% endfor %}
                                                                </tbody>
                                                            </table>
                                                        </div>
                                                    </div>
                                                </div>
                                                {% endfor %}
                                                    {% if procsansserv == 'vrai' %}
                                                        <div class="panel panel-danger">
                                                            <div class="panel-heading">
                                                                <h3 class="panel-title">
                                                                    Procédures non affectées à un service
                                                                </h3>
                                                            </div>
                                                            <div class="panel-body">            
                                                                <div class="table-responsive">
                                                                    <table class="table table-bordered table-hover tablesorter">
                                                                        <thead>
                                                                            <tr>
                                                                                <th width="24%">Procedure <i class="fa fa-sort"></i></th>
                                                                                <th width="24%">Responsable <i class="fa fa-sort"></i></th>
                                                                                <th width="20%">Date de Creation <i class="fa fa-sort"></i></th>
                                                                                <th width="20%">Date de dernière modification <i class="fa fa-sort"></i></th>
                                                                                <th width="12%"><center>Action <i class="fa fa-sort"></i></center></th>
                                                                        </tr>
                                                                        </thead>
                                                                        <tbody>
                                                                            {% for procedure in list_procedure %}
                                                                                {% if procedure.service == null %}
                                                                                    <tr>
                                                                                        <td>{{ procedure.nomProcedure }}</td>
                                                                                        {% if procedure.user!= null %}
                                                                                            <td>{{ procedure.user.nomUser }}</td>
                                                                                        {% else %}
                                                                                            <td>Pas de Responsable </td>
                                                                                        {% endif %}  
                                                                                        <td>{{ procedure.dateCreation|date("d/m/Y") }}</td>
                                                                                        <td>{{ procedure.dateModification|date("d/m/Y") }}</td>
                                                                                        <td><center><a href="{{path ('cnam_actiman_procedure_visuDetail',{'idpro': procedure.id})}}">Detail</a></center></td>
                                                                                </tr>
                                                                            {% endif %}
                                                                        {% endfor %}
                                                                        </tbody>
                                                                    </table>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    {% endif %}
                                                </div>
                                            </div>
                                        </div>

                                        {% endblock%}

                                            {% endblock%}
